# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=usbredir
pkgver=0.12.0
pkgrel=0
pkgdesc="USB network redirection protocol libraries"
url="https://www.spice-space.org/usbredir.html"
arch="all"
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
makedepends="libusb-dev meson glib-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-server"
source="https://www.spice-space.org/download/usbredir/usbredir-$pkgver.tar.xz"

# secfixes:
#   0.12.0-r0:
#     - CVE-2021-3700

build() {
	abuild-meson . output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

server() {
	pkgdesc="Simple USB host TCP server"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/
}

sha512sums="
f509a6b5d410fec53efbdc186b80376d6b7f5b34c6c33f2037a83bf105743667c5a18a6d1ef33d6b3c57c1ed6a52b94536369ca768eddb70fda7b436d35fe6ab  usbredir-0.12.0.tar.xz
"
